package com.lllteam.exam.account.library.network

import com.lllteam.exam.account.library.model.RegisterBean
import com.lllteam.exam.account.library.model.UserInfo
import io.reactivex.Single
import retrofit2.http.Body

object Repository {
    fun verifyCode(mobile: String): Single<BaseBean<RegisterBean>> {
        val body = HashMap<String, String>()
        body["mobile"] = mobile
        return Client.reqApi.verifyCode(body)
    }

    fun register(name: String, enName: String, grade: String, mobile: String, verifyCode: String,  seqID: String, school: String?, location: String?): Single<BaseBean<RegisterBean>> {
        val body = HashMap<String, String>()
        body["name"] = name
        body["enName"] = enName
        body["grade"] = grade
        body["mobile"] = mobile
        body["seqID"] = seqID
        body["verify_code"] = verifyCode
        body["school"] = school ?: ""
        body["location"] = location ?: ""
        return Client.reqApi.register(body)
    }

    fun modifyRegister(name: String, enName: String, grade: String, phone: String,  deviceId: String, school: String?, location: String?): Single<BaseBean<RegisterBean>> {
        val body = HashMap<String, String>()
        body["name"] = name
        body["enName"] = enName
        body["grade"] = grade
        body["phone"] = phone
        body["deviceId"] = deviceId
        body["school"] = school ?: ""
        body["location"] = location ?: ""
        return Client.reqApi.modifyRegister(body)
    }

    fun getUser(seqID: String): Single<BaseBean<UserInfo>> {
        return Client.reqApi.getUser(seqID)
    }
}